<!--
 * @Author: Bobby
 * @Date: 2021-12-30 10:01:42
 * @LastEditTime: 2022-03-08 17:04:28
 * @LastEditors: Bobby
 * @Description:
 * @FilePath: \wms-v2\src\ve\elements\form\uiRadio\uiRadio.vue
 * CIMC-V2
-->
<template>
  <UiFormItem :class="{ hidden: conditionProperty.hidden || info.extension.hidden.value }" :info="info">
    <el-radio-group
      :ref="info._id"
      v-model="formDataModel"
      v-ui-ref="vSetRef"
      :disabled="conditionProperty.disabled || info.extension.disabled.value"
      @change="handleChange"
      @keyup.enter="$handleEnter"
    >
      <el-radio v-for="(v, i) in getJsonList" :key="i" :label="v.value" :size="info.extension.size.value">
        {{ v.label }}
      </el-radio>
    </el-radio-group>
  </UiFormItem>
</template>
<script>
  import { defineComponent } from 'vue'
  import { UiMixin, ElementsFormMixin, RefsInjectMixin, ConditionMixin } from '@ve/mixin'
  export default defineComponent({
    name: 'UiRadio',
    components: {},
    mixins: [UiMixin, ElementsFormMixin, RefsInjectMixin, ConditionMixin],
    data() {
      return {}
    },
    computed: {
      getJsonList() {
        return this.info.extension.jsonList.value
      },
    },
    created() {},
    methods: {
      handleChange() {
        // 触发条件判断值改变
        this.setPageModulesState('value', this.formDataModel)
        // 调用 change 事件
        this.onChange()
      },
    },
  })
</script>
<style lang="scss" scoped>
  :deep() {
    .el-radio__label {
      margin-left: 0;
    }
  }
</style>
